package repoutil

import (
	"fmt"
	"path/filepath"

	"gitee.com/actor168/gitserver/pkg/config"
)

type CloneLink struct {
	SSH  string
	HTTP string
}

func UserPath(user string) string {
	return filepath.Join(config.Conf.Dir, user)
}

func RepoPath(userName, repoName string) string {
	return filepath.Join(UserPath(userName), repoName+".git")
}

func FullRepoName(userName, repoName string) string {
	return fmt.Sprintf("%s/%s", userName, repoName)
}
func HTTPCloneURL(owner, repo string) string {
	return fmt.Sprintf("%s%s/%s.git", config.Conf.ExternalURL, owner, repo)
}

func HTTPURL(owner, repo string) string {
	return fmt.Sprintf("%s%s/%s", config.Conf.ExternalURL, owner, repo)
}
